package com.wakala.employment.fragment.other;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.leaf.library.StatusBarUtil;
import com.wakala.employment.R;
import com.wakala.employment.core.BaseFragment;
import com.wakala.employment.databinding.FragmentBlankBinding;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.statelayout.StatefulLayout;
import com.xuexiang.xutil.common.StringUtils;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link BlankFragment#} factory method to
 * create an instance of this fragment.
 */
@Page(name = "Blank")
public class BlankFragment extends BaseFragment<FragmentBlankBinding> {

    private StatefulLayout statefulLayout;

    private String message;


    @NonNull
    @Override
    protected FragmentBlankBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) {
        return FragmentBlankBinding.inflate(inflater, container, attachToRoot);
    }

    @Override
    protected TitleBar initTitle() {
        TitleBar titleBar = super.initTitle();
        titleBar.setTitle("");
        titleBar.setTitleColor(R.color.black);
        titleBar.setLeftTextColor(R.color.black);
        titleBar.setLeftImageDrawable(getResources().getDrawable(R.drawable.icon_arrow_back));
        titleBar.setBackgroundResource(R.color.white);//设置标题栏背景颜色
        StatusBarUtil.setDarkMode(getActivity());
        //设置状态栏背景颜色，如果设置为 Color.TRANSPARENT 将会隐藏状态栏
        getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.white));
        return titleBar;
    }

    @Override
    protected void initArgs() {
        message = getArguments().getString("message");
    }

    @Override
    protected void initViews() {
        statefulLayout = binding.llStateful;
        if(StringUtils.isEmpty(message)){
            statefulLayout.showEmpty();
        }else {
            binding.cardTitleTv.setText(message);
            //statefulLayout.showEmpty(message);
        }

    }
}